<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>注册账号</title>
    <link rel="stylesheet" href="../SignUpStyle.css">
    <link href="https://fonts.googleapis.com/css?familymPermanent+Marker" >
    <script language="JavaScript" type="text/JavaScript">
        function isEmail(value){
            pattern = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/";
            if(preg_match(pattern,value)==true || value==null){
                return true;
            } else{
                return false;
            }
        }

        function check(form){
        var ID = form.ID.value;
        if(ID.length==0){
        alert("请填写账号！");
        form.ID.focus();
        return false;
        }

        var passwd = form.passwd.value;
        if(passwd.length==0){
        alert("请填写密码！");
        form.passwd.focus();
        return false;
        }

        var repasswd = form.repasswd.value;
        if(repasswd.length==0){
        alert("请填写确认密码!");
        form.repasswd.focus();
        return false;
        }

        if(passwd != repasswd){
        alert("两次密码不一致！");
        form.repasswd.focus();
        return false;
        }

        var email = form.email.value;
        if(isEmail(email)==false){
        alert("请填写正确的邮箱!");
        form.email.focus();
        return false;
        }

        }
    </script>
</head>

<body>
<div class="sign-div">
    <form class="" action="../Action/register_action.php" method="post" name="input" onSubmit="return check(this);">
        <h1>注册</h1>
        <input class="sign-text" type="text" placeholder="账号" name="ID">
        <input class="sign-text" type="text" placeholder="用户名" name="username">
        <input class="sign-text" type="password" placeholder="密码" name="passwd">
        <input class="sign-text" type="password" placeholder="确认密码" name="repasswd">
        <input class="sign-text" type="email" placeholder="邮箱" name="email">
        <select class="beauty-select" name="sex" size="1">
            <option value="保密" selected>------------------------请选择性别---------------------</option>
            <option value="保密" >保密</option>
            <option value="男">男</option>
            <option value="女">女</option> 
        </select>
        <input class="sign-btn" type="submit" value="注册账户">
        <a href="http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/login.php">已经拥有账户?</a>
    </form>
</div>
</body>
</html>

